package adapter;

import adapter.duck.Duck;
import adapter.turkey.Turkey;

/**
 * @author zhouyang
 * @title: TurkeyAdapter
 * @projectName DesignMode_Java
 * @description: 鸭子适配器类 必须实现鸭子
 * @date 2019/5/28 11:13
 */
public class TurkeyAdapter implements Duck {
    private Turkey turkey;

    //构造器里传入火鸡
    public TurkeyAdapter(Turkey turkey) {
        this.turkey = turkey;
    }

    @Override
    public void quack() {
        this.turkey.gobble();
    }

    @Override
    public void fly() {
        for(int i=0;i<6;++i){
            this.turkey.fly();
        }
    }
}
